package com.hotel.project.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hotel.project.demo.domain.HotelAnswerEntity;
import com.hotel.project.demo.service.HotelAnswerService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HotelAnswerServiceImpl extends CurdServiceImpl<HotelAnswerEntity> implements HotelAnswerService {

    public List<HotelAnswerEntity> listHotelAnswerEntityByQuestionId(Long questionId) {
        LambdaQueryWrapper<HotelAnswerEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(HotelAnswerEntity::getQuestionId,questionId);
        wrapper.eq(HotelAnswerEntity::getDeleted,1);
        List list = list(wrapper);
        System.out.println(list);
        return list;
    }

    public List<HotelAnswerEntity> listHotelAnswerEntityByUserId(Long id, Integer status) {
        LambdaQueryWrapper<HotelAnswerEntity> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(HotelAnswerEntity::getUserId,id);
        wrapper.eq(HotelAnswerEntity::getDeleted,status);
        List list = list(wrapper);
        System.out.println(list);
        return list;
    }
}
